import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import java.awt.GridBagLayout;
import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import java.awt.event.HierarchyListener;
import java.awt.event.HierarchyEvent;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JPopupMenu;
import java.awt.Component;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.ButtonGroup;
import javax.swing.KeyStroke;
import java.awt.event.KeyEvent;
import javax.swing.JProgressBar;
import javax.swing.JButton;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import javax.swing.SwingConstants;

import Uebersicht.Hauptfenster;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;


public class Home extends JFrame {

	private JPanel contentPane;
	private final ButtonGroup buttonGroup = new ButtonGroup();

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					Home frame = new Home();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public Home() {
		setTitle("Home");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 679, 476);
		
		JMenuBar menuBar = new JMenuBar();
		setJMenuBar(menuBar);
		
		JMenu mnMenu = new JMenu("Menu");
		menuBar.add(mnMenu);
		
		JMenu mnImport = new JMenu("Import");
		mnMenu.add(mnImport);
		
		JMenuItem mntmDaten = new JMenuItem("Daten");
		mnImport.add(mntmDaten);
		
		JMenuItem mntmNewMenuItem = new JMenuItem("Ambience");
		mnImport.add(mntmNewMenuItem);
		
		JMenu mnExport = new JMenu("Export");
		mnMenu.add(mnExport);
		
		JMenuItem mntmFrage = new JMenuItem("Fragen");
		mnExport.add(mntmFrage);
		
		JMenuItem mntmUser = new JMenuItem("User");
		mnExport.add(mntmUser);
		
		JMenuItem mntmMandanten = new JMenuItem("Mandanten");
		mnExport.add(mntmMandanten);
		
		JMenuItem mntmKategorien = new JMenuItem("Kategorien");
		mnExport.add(mntmKategorien);
		
		JMenuItem mntmHexagramme = new JMenuItem("Hexagramme");
		mnExport.add(mntmHexagramme);
		
		JMenu mnUser = new JMenu("User");
		mnMenu.add(mnUser);
		
		JMenuItem mntmBearbeiten = new JMenuItem("bearbeiten");
		mnUser.add(mntmBearbeiten);
		mntmBearbeiten.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent e) {
	        		UserEinstellungen us = new UserEinstellungen();
	        		us.setVisible(true);
				}
		});
		
		
		JMenuItem mntmNewMenuItem_1 = new JMenuItem("registrieren");
		mnUser.add(mntmNewMenuItem_1);
		mntmNewMenuItem_1.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
        		UserEinstellungen us = new UserEinstellungen();
        		us.setVisible(true);
			}
	});
		
		JMenu mnMandant = new JMenu("Mandant");
		mnMenu.add(mnMandant);
		
		JMenuItem mntmNewMenuItem_2 = new JMenuItem("erstellen");
		mnMandant.add(mntmNewMenuItem_2);
		
		JMenuItem mntmNewMenuItem_3 = new JMenuItem("bearbeiten");
		mnMandant.add(mntmNewMenuItem_3);
		
		JMenu mnKategorie = new JMenu("Kategorie");
		mnMenu.add(mnKategorie);
		
		JMenuItem mntmErstellen = new JMenuItem("erstellen");
		mnKategorie.add(mntmErstellen);
		
		JMenuItem mntmBearbeiten_1 = new JMenuItem("bearbeiten");
		mnKategorie.add(mntmBearbeiten_1);
		
		JMenu mnThema = new JMenu("Thema");
		mnMenu.add(mnThema);
		
		JMenuItem mntmErstellen_1 = new JMenuItem("erstellen");
		mnThema.add(mntmErstellen_1);
		
		JMenuItem mntmBearbeiten_2 = new JMenuItem("bearbeiten");
		mnThema.add(mntmBearbeiten_2);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		
		JButton btnNewButton = new JButton("neue Frage stellen");
		btnNewButton.setBounds(35, 35, 296, 29);
		btnNewButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
			}
		});
		contentPane.setLayout(null);
		btnNewButton.setHorizontalAlignment(SwingConstants.LEFT);
		contentPane.add(btnNewButton);
		
		JButton btnNewButton_1 = new JButton("Bestehende Frage ausw\u00E4hlen/bearbeiten");
		btnNewButton_1.setBounds(35, 99, 296, 29);
		contentPane.add(btnNewButton_1);
		
		JButton btnNewButton_2 = new JButton("Bibliothek");
		btnNewButton_2.setBounds(35, 163, 296, 29);
		btnNewButton_2.setHorizontalAlignment(SwingConstants.LEFT);
		btnNewButton_2.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				Bibliothek b = new Bibliothek();
				b.setVisible(true);
			}
			
		});
		
		contentPane.add(btnNewButton_2);
		
		JButton btnNewButton_3 = new JButton("FAQ's");
		btnNewButton_3.setBounds(35, 227, 296, 29);
		btnNewButton_3.setHorizontalAlignment(SwingConstants.LEFT);
		contentPane.add(btnNewButton_3);
		
		JButton btnNewButton_4 = new JButton("Abmelden");
		btnNewButton_4.setBounds(35, 291, 296, 29);
		btnNewButton_4.setHorizontalAlignment(SwingConstants.LEFT);
		
		btnNewButton_4.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				dispose();
			}
			
		});
	
		contentPane.add(btnNewButton_4);
		
			
		JButton btnNewButton_5 = new JButton("Beenden");
		btnNewButton_5.setBounds(35, 355, 296, 29);
		btnNewButton_5.setHorizontalAlignment(SwingConstants.LEFT);
		btnNewButton_5.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				System.exit(0);
			}
		});
		contentPane.add(btnNewButton_5);
		
	}

	private static void addPopup(Component component, final JPopupMenu popup) {
		component.addMouseListener(new MouseAdapter() {
			public void mousePressed(MouseEvent e) {
				if (e.isPopupTrigger()) {
					showMenu(e);
				}
			}
			public void mouseReleased(MouseEvent e) {
				if (e.isPopupTrigger()) {
					showMenu(e);
				}
			}
			private void showMenu(MouseEvent e) {
				popup.show(e.getComponent(), e.getX(), e.getY());
			}
		});
	}
}
